﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AppEnvironment.Lib;
using System.Web;
using AppEnvironment.Lib.Interfaces;

namespace AppEnvironment.Web
{
    internal class WebContextItems : Singleton<WebContextItems>, IStateHolder
    {
        private WebContextItems()
        {

        }

        #region IStateHolder Members

        public object this[string name]
        {
            get
            {
                if (HttpContext.Current.Items == null)
                {
                    return null;
                }
                return HttpContext.Current.Items[name];
            }
            set
            {
                if (HttpContext.Current.Items == null)
                {
                    throw new Exception("Context Items object is null at this time");
                }
                HttpContext.Current.Items[name] = value;
            }
        }


        #endregion
    }
}
